﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

namespace MiniSched.Web {
    
    public class MvcApplication : HttpApplication {
        
        protected void Application_Start() {
            AreaRegistration.RegisterAllAreas();

            var routes = RouteTable.Routes;
            routes.LowercaseUrls = true;
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

            var bundles = BundleTable.Bundles;
            bundles.Add(new StyleBundle("~/bundles/css").Include(
                "~/Content/bootstrap.css",
                "~/Content/site.css"
            ));

            bundles.Add(new ScriptBundle("~/bundles/scripts/jquery").Include(
                "~/Scripts/jquery-{version}.js"
            ));

            bundles.Add(new ScriptBundle("~/bundles/scripts/bootstrap").Include(
                "~/Scripts/bootstrap.js"
            ));

            bundles.Add(new ScriptBundle("~/bundles/scripts/knockout").Include(
                "~/Scripts/knockout-{version}.js",
                "~/Scripts/knockout.validation.js"
            ));

            bundles.Add(new ScriptBundle("~/bundles/scripts/site").Include(
                "~/Scripts/Site/miniSched.js",
                "~/Scripts/Site/Api/jsonApiClient.js",
                "~/Scripts/Site/Api/apiClient.js",
                "~/Scripts/Site/Api/entityApiClient.js",
                "~/Scripts/Site/Api/marketMessageSubscriptionApiClient.js",
                "~/Scripts/Site/Models/model.js",
                "~/Scripts/Site/Models/entity.js",
                "~/Scripts/Site/Models/emailAddress.js",
                "~/Scripts/Site/Models/marketMessage.js",
                "~/Scripts/Site/Models/marketMessageSubscription.js"
            ));
        }
    }
}
